	<!------------------------------------------------------------------------------
	--------------------------------------------------------------------------------

		ShowMeSmart! - View Helper

		Date		Name				Change
		5/09/2012	Kevin Chiu			Initial version
		____________________________________________________________________________

		Instructions:
		____________________________________________________________________________

		Provides a consistant central location for common HTML elements such as
		buttons, and simple select boxes. All attributes available to the element
		is available as a parameter pass-in, as well as custom data attributes for
		use with any JavaScript framework.

	--------------------------------------------------------------------------------
	------------------------------------------------------------------------------->
<cfsilent>
	<!------------------------------------
		Extension for of built-in CFWheels 
		Tag Include for LESS files 
	------------------------------------->
	<cffunction name="styleLESSLinkTag" returntype="string" access="public" output="false" hint="Returns a `link` tag for a LESS (or several) based on the supplied arguments.">
		<cfargument name="sources" type="string" required="false" default="" hint="The name of one or many CSS files in the `less` folder, minus the `.css` extension. (Can also be called with the `source` argument.)">
		<cfargument name="type" type="string" required="false" hint="The `type` attribute for the `link` tag.">
		<cfargument name="media" type="string" required="false" hint="The `media` attribute for the `link` tag.">
		<cfargument name="head" type="string" required="false" hint="Set to `true` to place the output in the `head` area of the HTML page instead of the default behavior, which is to place the output where the function is called from.">
		<cfargument name="delim" type="string" required="false" default="," hint="the delimiter to use for the list of stylesheets">
		<cfscript>
			var loc = {};

			$args(name="styleSheetLinkTag", args=arguments, combine="sources/source/!", reserved="href,rel");
			arguments.rel = "stylesheet";
			loc.returnValue = "";
			arguments.sources = $listClean(list=arguments.sources, returnAs="array", delim=arguments.delim);
			arguments.type="text/less";

			loc.iEnd = ArrayLen(arguments.sources);
			for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
			{
				loc.item = arguments.sources[loc.i];
				if (ReFindNoCase("^https?:\/\/", loc.item))
				{
					arguments.href = arguments.sources[loc.i];
				}
				else
				{
					arguments.href = application.wheels.webPath & "less/" & loc.item;
					if (!ListFindNoCase("less,cfm", ListLast(loc.item, ".")))
						arguments.href = arguments.href & ".less";
					arguments.href = $assetDomain(arguments.href) & $appendQueryString();
				}
				loc.returnValue = loc.returnValue & $tag(name="link", skip="sources,head,delim", close=true, attributes=arguments) & chr(10);
			}
			if (arguments.head)
			{
				$htmlhead(text=loc.returnValue);
				loc.returnValue = "";
			}
		</cfscript>
		<cfreturn loc.returnValue>
	</cffunction>

	<!------------------------------------
				Calendar
	------------------------------------->
	<cffunction name="dspCalendar">
		<cfargument name="deviation" required="yes">
		<cfscript>
			var $date = {
					"date" = DateAdd("m", ARGUMENTS.deviation, Now()),
					"month" = Month(DateAdd("m", ARGUMENTS.deviation, Now())),
					"day" = Day(DateAdd("m", ARGUMENTS.deviation, Now())),
					"year" = Year(DateAdd("m", ARGUMENTS.deviation, Now())),
					"intDays" = DaysInMonth(DateAdd("m", ARGUMENTS.deviation, Now()))
				};
			var calendarDays = [];
			var $calendar = {
					"days" = ListToArray('Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'),

					"today" = {
						"toString" = DateFormat($date.date, "mmmm, yyyy"),
						"date" = $date.date,
						"intDay" = DayOfWeek($date.date)
					},

					 "first" = {
						"date" = CreateDate($date.year, $date.month, 1),
						"intWeek" = DayOfWeek(CreateDate($date.year, $date.month, 1)),
						"intDay" = DayOfWeek(CreateDate($date.year, $date.month, 1))
					},
					
					"last" = {
						"intWeek" = DayOfWeek(CreateDate($date.year, $date.month, $date.intDays)),
						"intDay" = Day(CreateDate($date.year, $date.month, $date.intDays))
					},
					
					"intWeeks" = 0,
					"intDays" = 0,
					
					"month" = { 
						"previous" = {
						 	"toString" = DateFormat(DateAdd("m", -1, $date.date), "mmmm, yyyy"),
							"intDay" = DaysInMonth(DateAdd("m", -1, $date.date))
						},

						"next" = {
							"toString" = DateFormat(DateAdd("m", 1, $date.date), "mmmm, yyyy")
						}
					} 
				};
			
			for(intDay = 1; intDay LT $calendar.first.intDay; intDay++) {
				calendarDays[intDay] = $calendar.month.previous.intDay - $calendar.today.intDay + intDay - 1;
			}

			intDate = 0;

			for(intDay = intDay; intDay LTE 35; intDay++) {
				if(intDate LT $calendar.last.intDay) {
					intDate++;
					calendarDays[intDay] = intDate;
				} else {
					if(intDate EQ $calendar.last.intDay) 
						intDate = 1;
					else intDate++;
					calendarDays[intDay] = intDate;
				}
			}
		</cfscript>

		<cfsavecontent variable="calendar">
			<cfoutput>
				<table class="none" width="100%" align="left">
					<tr>
						<td class="left">
							<a class="btn btn-info btn-mini" href="#URLFor(controller='main',action='calendar',params='deviation=#ARGUMENTS.deviation - 1#')#">
								<i class="icon-chevron-left icon-white"></i>#$calendar.month.previous.toString#
							</a>
						</td>
						<td><h2>#$calendar.today.toString#</h2></td>
						<td class="right">
							<a 	class="btn btn-info pull-right btn-mini" style="margin-bottom:10px;"
								href="#URLFor(controller='main',action='calendar',params='deviation=#ARGUMENTS.deviation + 1#')#">
									#$calendar.month.next.toString#<i class="icon-chevron-right icon-white" style="margin-left:5px;margin-right:2px;"></i>
							</a>
						</td>
					</tr>
				</table>
				<table class="table table-bordered calendar">
					<tr class="calendar">
						<cfloop array="#$calendar.days#" index="days">
							<th>#days#</th>
						</cfloop>
					</tr>
					<cfscript>
						isStyle = {};
						isStyle.disabled = 1;
						isStyle.today = (ARGUMENTS.deviation == 0) ? $date.day : 0;
					</cfscript>
					<cfloop from="1" to="5" index="intWeek">
						<tr>
							<cfscript>
								intDate = {};
								intDate.start = ((intWeek - 1) * 7) + 1;
								intDate.end = intDate.start + 6;
							</cfscript>
							<cfloop from="#intDate.start#" to="#intDate.end#" index="intDay">
								<cfscript>
									class = { "span" = "", "td" = "" };

									if(calendarDays[intDay] == 1)
										isStyle.disabled = (isStyle.disabled) ? 0 : 1;
									if(isStyle.disabled) {
										class.td = "disabled";
										class.span = "btn btn-inverse btn-mini active";
									} else class.span = "btn btn-mini active";

									class.td = (isStyle.today == calendarDays[intDay]) ? "enabled" : class.td;
								</cfscript>
								<td class="#class.td#">
									<span class="#class.span#">#calendarDays[intDay]#</span>
									<cfif StructKeyExists(SESSION, "user") AND class.td IS NOT "disabled">
										<span class="calendarAddButton" title="Add Calendar Event"><i class="icon-plus-sign"></i></span>
									</cfif>
								</td>
							</cfloop>
						</tr>
					</cfloop>
				</table>
			</cfoutput>
		</cfsavecontent>
		<cfreturn calendar>
	</cffunction>

	<!------------------------------------
				Select Options
	------------------------------------->
	<cffunction name="dspSelect" access="public">
		<cfargument name="query" required="yes">
		<cfargument name="name" type="string" required="yes">
		<cfargument name="option" type="string" required="yes">
		<cfargument name="value" type="string" required="yes">
		<cfargument name="default" type="string" required="no">
		<cfargument name="selected" type="string" required="no">
		<cfargument name="class" type="string" required="no" default="">
		<cfscript>
			var element = XMLNew();
			var select = XMLElemNew(element, "select");
				select.XMLAttributes = { "name" = "#ARGUMENTS.name#", "class" = "#ARGUMENTS.class#" };

			select.XMLChildren[1] = XMLElemNew(element, "option");
			select.XMLChildren[1].XMLAttributes["value"] = "0";
			select.XMLChildren[1].XMLText = "-- Select #ARGUMENTS.default# --";

			for(attr IN ARGUMENTS) {
				if(NOT ListFindNoCase("query,name,option,value,default,selected,class", attr)) {
					if(StructKeyExists(select.XMLAttributes, attr)) {
						select.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
					} else {
						select.XMLAttributes[attr] = ARGUMENTS[attr];
					}
				}
			}

			for(intRow = 1; intRow LTE ARGUMENTS.query.RecordCount; intRow++) {
				select.XMLChildren[intRow + 1] = XMLElemNew(element, "option");
				
				if(IsDefined("ARGUMENTS.selected") AND ARGUMENTS.selected EQ ARGUMENTS.query[ARGUMENTS.value][intRow]) {
					select.XMLChildren[intRow + 1].XMLAttributes["selected"] = "true";
				}

				select.XMLChildren[intRow + 1].XMLAttributes["value"] = "#ARGUMENTS.query[ARGUMENTS.value][intRow]#";
				select.XMLChildren[intRow + 1].XMLText = "#ARGUMENTS.query[ARGUMENTS.option][intRow]#";
			}

			return select;
		</cfscript>
	</cffunction>

	<!------------------------------------
				Add Buttons
	------------------------------------->
	<cffunction name="dspAddButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "div");
				button.XMLAttributes = {
					"style" = 'margin-left:0px; margin-top:10px; margin-bottom: 10px;',
					'class' = 'addButton'
				};

				iconStyle = (IsDefined("ARGUMENTS.text")) ? "margin-right: 6px;" : "";

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-primary";
				button.XMLChildren[1].XMLText = '<i class="icon-plus icon-white" style="margin-top:0px;#iconStyle#"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Add";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Save Buttons
	------------------------------------->
	<cffunction name="dspSaveButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'saveButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-success";
				button.XMLChildren[1].XMLText = '<i class="icon-save icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Add";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Delete Buttons
	------------------------------------->
	<cffunction name="dspDeleteButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'deleteButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-danger";
				button.XMLChildren[1].XMLText = '<i class="icon-trash icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Delete";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

		<!------------------------------------
				Delete Buttons
	------------------------------------->
	<cffunction name="dspDeleteSubItemButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'deleteButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes = {
					'class' = "btn btn-mini btn-subDanger"//,
				//	'style' = "padding: 3px 1px 3px 1px"
				};
				button.XMLChildren[1].XMLText = '<i class="icon-remove icon-white" style=" margin-top:1px;margin-right:0px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Next Buttons
	------------------------------------->
	<cffunction name="dspNextButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'addButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-info";
				button.XMLChildren[1].XMLText = '<i class="icon-arrow-right icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Next";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Edit Buttons
	------------------------------------->
	<cffunction name="dspEditButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'editButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-inverse";
				button.XMLChildren[1].XMLText = '<i class="icon-pencil icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Edit";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Previous Buttons
	------------------------------------->
	<cffunction name="dspBackButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'backButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-info";
				button.XMLChildren[1].XMLText = '<i class="icon-arrow-left icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Back";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Copy Buttons
	------------------------------------->
	<cffunction name="dspCopyButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = {
					'class' = 'addButton'
				};

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-warning";
				button.XMLChildren[1].XMLText = '<i class="icon-file icon-white" style="margin-top:1px;"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "Copy";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
				Export Buttons
	------------------------------------->
	<cffunction name="dspExportButton" access="public">
		<cfscript>
			var element = XMLNew();
			var button = XMLElemNew(element, "span");
				button.XMLAttributes = { 'class' = 'addButton' };

				iconStyle = (IsDefined("ARGUMENTS.text")) ? "margin-right: 6px;" : "";

				button.XMLChildren[1] = XMLElemNew(element, "span");
				button.XMLChildren[1].XMLAttributes['class'] = "btn btn-small btn-export";
				button.XMLChildren[1].XMLText = '<i class="icon-excel icon-white" style="margin-top:1px;#iconStyle#"></i>';
				button.XMLChildren[1].XMLText &= (IsDefined("ARGUMENTS.text")) ? ARGUMENTS.text : "";

			for(attr IN ARGUMENTS) {
				if(StructKeyExists(button.XMLAttributes, attr)) {
					button.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
				} else {
					button.XMLAttributes[attr] = ARGUMENTS[attr];
				}
			}

			return Replace(Replace(REReplace(ToString(button), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
		Phone Number Input (Numeric Only)
	------------------------------------->
	<cffunction name="dspPhoneNumber">
		<cfscript>
			var element = XMLNew();
			var phoneNumber = XMLElemNew(element, "div");
				phoneNumber.XMLAttributes = { "style" = "width:auto;" };
				phoneNumber.XMLText = " ";

				phoneNumber.XMLChildren[1] = XMLElemNew(element, "span");
				phoneNumber.XMLChildren[2] = XMLElemNew(element, "input");
				phoneNumber.XMLChildren[3] = XMLElemNew(element, "span");
				phoneNumber.XMLChildren[4] = XMLElemNew(element, "input");
				phoneNumber.XMLChildren[5] = XMLElemNew(element, "span");
				phoneNumber.XMLChildren[6] = XMLElemNew(element, "input");

				phoneNumber.XMLChildren[1].XMLAttributes = {'class' = 'prepend', 'style' = 'margin-top:6px;' };
				phoneNumber.XMLChildren[2].XMLAttributes = {'class' = 'phone3 numeric append prepend', 'maxlength' = '3', 'style' = 'margin-bottom:0px;' };
				phoneNumber.XMLChildren[3].XMLAttributes = {'class' = 'prepend append prepend' };
				phoneNumber.XMLChildren[4].XMLAttributes = { 'class' = 'phone3 numeric append prepend', 'maxlength' = '3', 'style' = 'margin-bottom:0px;' };
				phoneNumber.XMLChildren[5].XMLAttributes = { 'class' = 'prepend append', 'style' = 'margin-top:2px;' };
				phoneNumber.XMLChildren[6].XMLAttributes = { 'class' = 'phone4 numeric append', 'maxlength' = '4', 'style' = 'margin-bottom:0px;' };

				if(IsDefined("ARGUMENTS.value")) {
					if(Len(ARGUMENTS.value) EQ 10) {
						phoneNumber.XMLChildren[2].XMLAttributes["value"] = Mid(ARGUMENTS.value, 1, 3);
						phoneNumber.XMLChildren[4].XMLAttributes["value"] = Mid(ARGUMENTS.value, 4, 3);
						phoneNumber.XMLChildren[6].XMLAttributes["value"] = Mid(ARGUMENTS.value, 7, 4);
					}
				}

				phoneNumber.XMLChildren[1].XMLText = '(';
				phoneNumber.XMLChildren[3].XMLText = ') ';
				phoneNumber.XMLChildren[5].XMLText = ' - ';

			if(StructKeyExists(ARGUMENTS, "class")) {
				phoneNumber.XMLAttributes['class'] = ARGUMENTS['class'];
			}

			for(attr IN ARGUMENTS) {
				if(NOT ListFindNoCase("class,value", LCase(attr))) {
					for(intPhoneNumber IN [2,4,6]) {
						if(StructKeyExists(phoneNumber.XMLChildren[intPhoneNumber].XMLAttributes, attr)) {
							phoneNumber.XMLChildren[intPhoneNumber].XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
						} else {
							phoneNumber.XMLChildren[intPhoneNumber].XMLAttributes[attr] = ARGUMENTS[attr];
						}
					}
				}
			}

			for(attr IN ARGUMENTS) {
				if(NOT ListFindNoCase("class,value", LCase(attr))) {
					if(StructKeyExists(phoneNumber.XMLAttributes, attr)) {
						phoneNumber.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
					} else {
						phoneNumber.XMLAttributes[attr] = ARGUMENTS[attr];
					}
				}
			}

			return Replace(Replace(REReplace(ToString(phoneNumber), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
			E-Mail Inputs
	------------------------------------->
	<cffunction name="dspEmailAddress">
		<cfscript>
			var element = XMLNew();
			var emailAddress = XMLElemNew(element, "div");
				emailAddress.XMLAttributes = { "style" = "width:auto;" };
				emailAddress.XMLText = " ";

				emailAddress.XMLChildren[1] = XMLElemNew(element, "input");
				emailAddress.XMLChildren[2] = XMLElemNew(element, "span");
				emailAddress.XMLChildren[3] = XMLElemNew(element, "input");

				emailAddress.XMLChildren[1].XMLAttributes = {
					'class' = 'email1 input-prepend input-append append prepend validate[required]', 
					'maxlength' = '35',
					'style' = 'margin:0px;',
					'placeholder' = 'E-Mail',
					'name' = 'email-1'
				};
				emailAddress.XMLChildren[2].XMLAttributes = {
					'class' = 'prepend append prepend',
					'style' = 'background-color:##F5F5F5;color:##AAAAAA;width:1.5em;'
				};
				emailAddress.XMLChildren[3].XMLAttributes = { 
					'class' = 'email2 append prepend validate[required]', 
					'maxlength' = '25',
					'style' = 'margin:0px;',
					'placeholder' = 'Domain',
					'name' = 'email-2'
				};

				if(IsDefined("ARGUMENTS.value")) {
					if(Find("@", ARGUMENTS.value)) {
						intIndex = Find("@", ARGUMENTS.value);
						emailAddress.XMLChildren[1].XMLAttributes["value"] = Mid(ARGUMENTS.value, 1, intIndex - 1);
						emailAddress.XMLChildren[3].XMLAttributes["value"] = Mid(ARGUMENTS.value, intIndex + 1, Len(ARGUMENTS.value));
					}
				}

			emailAddress.XMLChildren[2].XMLChildren[1] = XMLElemNew(element, "input");
			emailAddress.XMLChildren[2].XMLChildren[2] = XMLElemNew(element, "span");
			emailAddress.XMLChildren[2].XMLChildren[2].XMLText = "@";
			emailAddress.XMLChildren[2].XMLChildren[2].XMLAttributes = {
				"style" = "display:inline-block;margin-top:0px;margin-bottom:2px;"
			};
			emailAddress.XMLChildren[2].XMLChildren[1].XMLAttributes = {
				"type" = "hidden",
				"id" = "email-2",
				"name" = "email",
				"value" = "@"
			};



			if(StructKeyExists(ARGUMENTS, "class")) {
				emailAddress.XMLAttributes['class'] = ARGUMENTS['class'];
			}

			for(attr IN ARGUMENTS) {
				if(NOT ListFindNoCase("class,value", LCase(attr))) {
					for(intEmailAddress IN [1,3]) {
						if(StructKeyExists(emailAddress.XMLChildren[intEmailAddress].XMLAttributes, attr)) {
							emailAddress.XMLChildren[intEmailAddress].XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
						} else {
							emailAddress.XMLChildren[intEmailAddress].XMLAttributes[attr] = ARGUMENTS[attr];
						}
					}
				}
			}

			return Replace(Replace(REReplace(ToString(emailAddress), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
		DatePicker Input
		(ID and jQuery call are needed)
	------------------------------------->
	<cffunction name="dspDatePicker">
		<cfargument name="id" type="string" required="yes">
		<cfargument name="name" type="string" required="no" default="">
		<cfargument name="value" type="string" required="no" default="#DateFormat(now(), "mm/dd/yyyy")#">
		<cfscript>
			var element = XMLNew();
			var datePicker = XMLElemNew(element, "div");
				datePicker.XMLAttributes = {
					"class" = "date ",
					"data-date-format" = "mm/dd/yyyy",
					"data-date" = "#ARGUMENTS.value#"
				};

				for(attr IN ARGUMENTS) {
					if(NOT ListFindNoCase("value,name", attr)) {
						if(StructKeyExists(datePicker.XMLAttributes, attr)) {
							datePicker.XMLAttributes[attr] &= " #ARGUMENTS[attr]#";
						} else {
							datePicker.XMLAttributes[attr] = ARGUMENTS[attr];
						}
					}
				}

				datePicker.XMLChildren[1] = XMLElemNew(element, "input");
				datePicker.XMLChildren[1].XMLAttributes = { 
					"size" = "10",
					"type" = "text",
					"name" = ARGUMENTS.name,
					"readonly" = "",
					"class" = "prepend input-date",
					"style" = "width:180px;",
					"value" = "#ARGUMENTS.value#"
				};

				datePicker.XMLChildren[2] = XMLElemNew(element, "span");
				datePicker.XMLChildren[2].XMLAttributes["class"] = "append add-on";

				datePicker.XMLChildren[2].XMLChildren[1] = XMLElemNew(element, "i");
				datePicker.XMLChildren[2].XMLChildren[1].XMLText = " ";
				datePicker.XMLChildren[2].XMLChildren[1].XMLAttributes = {
					"class" = "icon icon-calendar",
					"style" = "margin-left: 4px; margin-top: 1px;"
				};

			return Replace(Replace(REReplace(ToString(datePicker), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<!------------------------------------
		Select Boxes
	------------------------------------->
	<cffunction name="dspParentSelect">
		<cfargument name="value" type="string" required="no" default="">
		<cfargument name="title" type="string" required="no" default="">
		<cfargument name="exceptions" type="string" required="no" default="">
		<cfscript>
			var parents = model("student").findAll(orderBy="last_name ASC");
			var element = XMLNew();
			var select = XMLElemNew(element, "select");
				select.XMLAttributes = {
					"multiple" = "multiple",
					"class" = "multiple",
					"label" = ARGUMENTS.title,
					"id" = "items"
				};

			for(intRow = 1; intRow LTE parents.RecordCount; intRow++) {
				if(ARGUMENTS.exceptions IS "" OR NOT ListFindNoCase(ARGUMENTS.exceptions, parents.id[intRow])) {
					select.XMLChildren[intRow] = XMLElemNew(element, "option");
					select.XMLChildren[intRow].XMLText = "#parents.first_name[intRow]# #parents.last_name[intRow]#";
					select.XMLChildren[intRow].XMLAttributes["value"] = parents.id[intRow];

					if(ListFindNoCase(ARGUMENTS.value,parents.id[intRow]))
						select.XMLChildren[intRow].XMLAttributes["selected"] = true;
				}
			}

			return Replace(Replace(REReplace(ToString(select), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>

	<cffunction name="dspStudentSelect">
		<cfargument name="value" type="string" required="no" default="">
		<cfargument name="title" type="string" required="no" default="">
		<cfargument name="exceptions" type="string" required="no" default="">
		<cfscript>
			var students = model("student").findAll(orderBy="last_name ASC");
			var element = XMLNew();
			var select = XMLElemNew(element, "select");
				select.XMLAttributes = {
					"multiple" = "multiple",
					"class" = "multiple",
					"label" = ARGUMENTS.title,
					"id" = "items"
				};

			for(intRow = 1; intRow LTE students.RecordCount; intRow++) {
				if(ARGUMENTS.exceptions IS "" OR NOT ListFindNoCase(ARGUMENTS.exceptions, students.id[intRow])) {
					select.XMLChildren[intRow] = XMLElemNew(element, "option");
					select.XMLChildren[intRow].XMLText = "#students.first_name[intRow]# #students.last_name[intRow]#";
					select.XMLChildren[intRow].XMLAttributes["value"] = students.id[intRow];

					if(ListFindNoCase(ARGUMENTS.value,students.id[intRow]))
						select.XMLChildren[intRow].XMLAttributes["selected"] = true;
				}
			}

			return Replace(Replace(REReplace(ToString(select), "<\?xml.+?>", "", "All"), "&lt;", "<", "All"), "&gt;", ">", "All");
		</cfscript>
	</cffunction>
</cfsilent>
